package com.hnevc.xiewenguang;

import java.util.Scanner;

public class Example01 {

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入数字:");
        int num = scanner.nextInt();
        int reault = fact(num);
        System.out.println(num+"的阶乘为"+reault);
    }
    public static int fact(int n){
        if(n == 1){
            return 1;
        }
        else {
            return n*fact(n-1);
        }
    }

}
